package com.atguigu.tingshu.album.controller;

import com.atguigu.tingshu.album.service.TrackInfoService;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.common.util.AuthContextHolder;
import com.atguigu.tingshu.vo.album.TrackInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Tag(name = "声音管理")
@RestController
@RequestMapping("admin/album/trackInfo")
@SuppressWarnings({"all"})
public class TrackInfoController {

	@Autowired
	private TrackInfoService trackInfoService;

	@Operation(summary = "新增声音")
	@PostMapping("saveTrackInfo")
	public Result saveTrackInfo(@RequestBody @Validated TrackInfoVo trackInfoVo) {
		//	调用服务层方法
		trackInfoService.saveTrackInfo(trackInfoVo, AuthContextHolder.getUserId());
		return Result.ok();
	}
	@Operation(summary = "删除声音信息")
	@DeleteMapping("removeTrackInfo/{id}")
	public Result removeTrackInfo(@PathVariable Long id) {
		//	调用服务层方法
		trackInfoService.removeTrackInfo(id);
		return Result.ok();
	}
}

